//
//  LTMineTableViewCell.m
//  LearnTeacher
//
//  Created by zyl on 2024/4/10.
//

#import "LTMineTableViewCell.h"

@implementation LTMineTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];

    [self.contentView addSubview:self.titleButton];
    [self.contentView addSubview:self.arrowButton];
    self.contentView.backgroundColor = LTClearColor;
    self.backgroundColor = LTClearColor;
    return self;
}

- (UIButton *)titleButton
{
    if (!_titleButton) {
        _titleButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _titleButton.frame = CGRectMake(24, 0, 94, 60);
        _titleButton.titleLabel.font = MFontWithSize(15.f);
        [_titleButton setTitleColor:LTTextBlack forState:UIControlStateNormal];
        _titleButton.userInteractionEnabled = NO;
    
    }
    return _titleButton;
}
- (UIButton *)arrowButton
{
    if (!_arrowButton) {
        _arrowButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _arrowButton.frame = CGRectMake((LTScreenWidth - 24 - 12), 0, 12, 60);
        _arrowButton.userInteractionEnabled = NO;
       [_arrowButton setImage:IMAGENAMED(@"ic_right_arrow_gray") forState:UIControlStateNormal];
    
    }
    return _arrowButton;
}

- (void)setData:(NSDictionary *)data
{
    _data = data;
            [self.titleButton setTitle:data[@"title"] forState:UIControlStateNormal];
            [self.titleButton setImage:IMAGENAMED(data[@"img"]) forState:UIControlStateNormal];
    double width = [MethodTool getTextWidthWithStr:data[@"title"] font:self.titleButton.titleLabel.font ViewHeight:self.titleButton.height];
    self.titleButton.width = 24 + width;
    [self.titleButton layoutButtonWithEdgeInsetsStyle:LButtonEdgeInsetsStyleLeft imageTitleSpace:15];
   
}

@end
